﻿using NPSoft.Ferrero.Framework.Utility.SysHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace NPSoft.Ferrero.Framework.Web.Test
{
    /// <summary>
    /// TestWebService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    [System.Web.Script.Services.ScriptService]
    public class TestWebService : System.Web.Services.WebService
    {

        [WebMethod]
        public void ExportCSV()
        {
            IList<ModelClass> lstModel = new List<ModelClass>();

            ModelClass a = new ModelClass();
            a.Code = "A";
            lstModel.Add(a);
             ModelClass b = new ModelClass();
            a.Code = "B";
            lstModel.Add(b);
             ModelClass c = new ModelClass();
            a.Code = "C";
            lstModel.Add(c);
             ModelClass d = new ModelClass();
            a.Code = "D";
            lstModel.Add(d);
            CsvHelper.SaveAsCSV<ModelClass>("test.csv", lstModel);
        }
    }
}
